﻿using System;
using System.Linq;
using System.Collections.Generic;
using System.Text;
using System.Xml;

namespace FourSquareNETLibrary
{
    public class tip
    {
        private string _id;
        private string _text;
        private Uri _url;
        private DateTime _created;
        private user _user;
        private venue _venue;

        public tip(XmlNode Xml)
        {
            XmlNodeList xnl = Xml.ChildNodes;

            foreach (XmlNode xn in xnl)
            {
                switch (xn.Name)
                {
                    case "id":
                        this._id = xn.InnerText;
                        break;
                    case "text":
                        this._text = xn.InnerText;
                        break;
                    case "url":
                        this._url = new Uri(xn.InnerText);
                        break;
                    case "created":
                        this._created = DateTime.Parse(xn.InnerText);
                        break;
                    case "user":
                        this._user = new user(xn);
                        break;
                    case "venue":
                        this._venue = new venue(xn);
                        break;
                }
            }
        }

        public string Id
        {
            get
            {
                return this._id;
            }
        }

        public string Text
        {
            get
            {
                return this._text;
            }
        }

        public Uri Url
        {
            get
            {
                return this._url;
            }
        }

        public DateTime Created
        {
            get
            {
                return this._created;
            }
        }

        public user User
        {
            get
            {
                return this._user;
            }
        }

        public venue Venue
        {
            get
            {
                return this._venue;
            }
        }


    }
}
